﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace HotelSoftBusClient
{
    public static class AppGlobal
    {
        public static void Init()
        {
            //string file = System.Environment.CurrentDirectory+"\\config.xml";
            //XElement root = XElement.Load(file);

            //XElement serverEl = root.Element("Server");

            //ServerIp = serverEl.Attribute("Ip").Value;

            //ServerPort = int.Parse(serverEl.Attribute("Port").Value);

            //XElement localEl=root.Element("Local");

            //LocalIp = localEl.Attribute("Ip").Value;
            //LocalPort = int.Parse(localEl.Attribute("Port").Value);
            ServerIp = ConfigurationManager.AppSettings["SocketIP"].ToString().Trim();
            ServerPort = int.Parse(ConfigurationManager.AppSettings["SocketPort"].ToString().Trim());
            LocalIp = ConfigurationManager.AppSettings["LocalIP"].ToString().Trim();
            LocalPort = int.Parse(ConfigurationManager.AppSettings["LocalPort"].ToString().Trim());
            PassWord = ConfigurationManager.AppSettings["PassWord"].ToString().Trim();
            UserName = ConfigurationManager.AppSettings["UserName"].ToString().Trim();
            CardType = int.Parse(ConfigurationManager.AppSettings["CardType"].ToString().Trim());
            SocketExecutor s = new SocketExecutor();
            s.Start();
        }

        public static string ServerIp { get; set; }

        public static int ServerPort { get; set; }

        public static string LocalIp { get; set; }

        public static int LocalPort { get; set; }


        public static string PassWord { get; set; }

        public static string UserName { get; set; }

        public static int CardType { get; set; }
    }
}
